package com.lagou.mr.homework1;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class NumberBean implements WritableComparable<NumberBean> {
    private Integer num;
    @Override
    public int compareTo(NumberBean o) {
        return this.getNum().compareTo( o.num );
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt( num );
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.num = dataInput.readInt();
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public NumberBean() {
    }

    public NumberBean(Integer num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return num.toString() ;
    }
}
